-
Notifications
You must be signed in to change notification settings - Fork 79
Add a subscriber/publisher demo for typescript #1194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds a TypeScript-based ROS2 topics demo using rclnodejs, including publisher and subscriber examples, build configuration, and documentation.
- Introduce
tsconfig.jsonfor TypeScript compilation. - Add
publisher.tsandsubscriber.tsdemo implementations. - Provide
package.jsonscripts and detailedREADME.mdguide.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| ts_demo/topics/tsconfig.json | TypeScript compiler configuration for the demo |
| ts_demo/topics/src/subscriber.ts | Subscriber example implementation |
| ts_demo/topics/src/publisher.ts | Publisher example implementation |
| ts_demo/topics/package.json | Project metadata, dependencies, and npm scripts |
| ts_demo/topics/README.md | Demo documentation, usage instructions, and examples |
Comments suppressed due to low confidence (1)
ts_demo/topics/README.md:137
- The README shows a 1000ms timer interval, but the code logs and uses
1000000000n. Please align the documentation with the implementation by updating either the code or the README.
✓ Created timer with 1000ms interval
ts_demo/topics/src/publisher.ts
Outdated
| import * as rclnodejs from 'rclnodejs'; | ||
|
|
||
| const TOPIC_NAME = 'ts_demo'; | ||
| const PUBLISH_INTERVAL = 1000000000n; // milliseconds |
Copilot
AI
Jul 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PUBLISH_INTERVAL is declared as a BigInt (1000000000n) and labeled as milliseconds, which will result in a very long delay (about 11.5 days) and doesn’t match the README’s 1000ms example. Consider using a numeric literal (e.g., 1000) instead to match the intended interval.
| const PUBLISH_INTERVAL = 1000000000n; // milliseconds | |
| const PUBLISH_INTERVAL = 1000; // milliseconds |
ts_demo/topics/package.json
Outdated
| "name": "rclnodejs-ts-topics-demo", | ||
| "version": "1.0.0", | ||
| "description": "TypeScript demo for rclnodejs topics (publisher and subscriber)", | ||
| "main": "index.js", |
Copilot
AI
Jul 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The main field points to index.js, which doesn’t exist in this project. Update it to an existing entry (e.g., dist/publisher.js) or remove it if unused.
| "main": "index.js", | |
| "main": "dist/publisher.js", |
Adds a TypeScript-based ROS2 topics demo using rclnodejs, including publisher and subscriber examples, build configuration, and documentation. - Introduce `tsconfig.json` for TypeScript compilation. - Add `publisher.ts` and `subscriber.ts` demo implementations. - Provide `package.json` scripts and detailed `README.md` guide. Fix: #1192
Adds a TypeScript-based ROS2 topics demo using rclnodejs, including publisher and subscriber examples, build configuration, and documentation.
tsconfig.jsonfor TypeScript compilation.publisher.tsandsubscriber.tsdemo implementations.package.jsonscripts and detailedREADME.mdguide.Fix: #1192